<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="./js/vue.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/vuex/3.2.0/vuex.min.js"></script>
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <p v-if="show">这是一段文本</p>
      <button v-on:click="handleClose">点击隐藏</button>
    </div>
  </body>
  <script>
    var app = new Vue({
      el: "#app",
      data: {
        show: true
      },
      methods: {
        /* handleClose: function () {
          this.close()
        },
        close: function () {
          this.show = !this.show
        },
        init: function (text) {
          console.log(text)
        } */

        init: function (text) {
          console.log(text)
        }
      },
      mounted() {
        this.init("在初始化时调用")
      }
    })

    app.init("通过外部调用")
  </script>
</html>
